﻿<ViewDataFormTemplateSpec 
	xmlns="bb_appfx_viewdataformtemplate" 
	xmlns:common="bb_appfx_commontypes" 
	ID="9c5b8ba9-31d6-44fa-af28-8bc4fb59fedf" 
	Name="Attribute Category Get ID"
	Description="Attribute Category Get ID form Name"
	Author="Blackbaud Professional Services"
	DataFormInstanceID="fe890ceb-65f6-4c51-90e8-d9ffe20b0263" 
	RecordType="AttributeCategory"
	common:SecurityUIFolder="Service Bus Adapter"
	>

	<!-- define the SP that returns the data used by the form -->
	<SPDataForm SPName="USP_DATAFORMTEMPLATE_VIEW_GETATTRIBUTECATEGORYID">
		<common:CreateProcedureSQL>
			<![CDATA[
create procedure dbo.USP_DATAFORMTEMPLATE_VIEW_GETATTRIBUTECATEGORYID
(
	@ID nvarchar(200),
	@DATALOADED bit = 0 output,
	@ATTRIBUTECATEGORYID uniqueidentifier = null OUTPUT
)
as
	set nocount on;
	
	-- be sure to set this, in case the select returns no rows
	set @DATALOADED = 0;
	
	-- populate the output parameters, which correspond to fields on the form.  Note that
	-- we set @DATALOADED = 1 to indicate that the load was successful.  Otherwise, the system
	-- will display a "no data loaded" message.
	select TOP 1 @DATALOADED = 1,
		   @ATTRIBUTECATEGORYID = ID
	from dbo.ATTRIBUTECATEGORY
	where NAME = @ID
	
	return 0;
			]]>
		</common:CreateProcedureSQL>
	</SPDataForm>

	<!-- describe fields on the form, which correspond to parameters on the SP.  Note that system paramters 
	like the context @ID, @DATALOADED, and @CURRENTAPPUSERID need not be listed. -->
  <common:FormMetaData FixedDialog="true">
    <common:FormFields>
      <common:FormField FieldID="ATTRIBUTECATEGORYID" DataType="Guid" Caption="ATTRIBUTECATEGORYID" />
    </common:FormFields>
  </common:FormMetaData>

</ViewDataFormTemplateSpec> 